package com.neuedu.yyzx.controller;

import com.neuedu.yyzx.entity.Bed;
import com.neuedu.yyzx.service.IBedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/test")

public class TestController {
    //http://localhost:8080/test/show
    @Autowired
    IBedService bedService;
    @RequestMapping("/show")
    public Map<String ,String> show(){
        System.out.println("TestController.show--------------------start");
        Map<String ,String > map = new HashMap<>();
        map.put("code","200");
        map.put("msg","success");
        Bed bed = new Bed();
        bed.setDeleted(0);

//        Beds bed = bedService.getById("1");
//        System.out.println("bed = " + bed);
//        System.out.println("bed.getDelFlag() ----------更改前------- " + bed.getDelFlag());
//        bed.setDelFlag("1");
//        bedService.saveOrUpdate(bed);
        bedService.saveOrUpdate(bed);
//        System.out.println("bed.getDelFlag() ----------更改后------- " + bed.getDelFlag());
        System.out.println("bed ------------ " + bed);
        System.out.println("bed.getId() = " + bed.getBedId());
        System.out.println("TestController.show--------------------end");
        return map;
    }
}
